﻿using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace DSVISUAL.LocalDNS
{
    public class PublicDns
    {
        static List<PublicDns> _list = new List<PublicDns>();
        public static List<PublicDns> List { get { return _list.ToList(); } }
        static PublicDns()
        {
            if (File.Exists("dns.txt"))
            {
                var dnsList = File.ReadAllLines("dns.txt");
                foreach (var item in dnsList)
                {
                    var pair = item.Split(new char[] { ' ' }, 2);
                    if (pair.Length == 2)
                    {
                        _list.Add(new PublicDns { Provider = $"{pair[1]} {pair[0]}", DNS = pair[0] });
                    }
                }
            }
            _list.Add(new PublicDns { Provider = "阿里DNS 223.5.5.5", DNS = "223.5.5.5" });
            _list.Add(new PublicDns { Provider = "阿里DNS 223.6.6.6", DNS = "223.6.6.6" });
            _list.Add(new PublicDns { Provider = "百度DNS 180.76.76.76", DNS = "180.76.76.76" });
            _list.Add(new PublicDns { Provider = "114DNS 114.114.114.114", DNS = "114.114.114.114" });
            _list.Add(new PublicDns { Provider = "114DNS 114.114.115.115", DNS = "114.114.115.115" });
            _list.Add(new PublicDns { Provider = "谷歌DNS 8.8.8.8", DNS = "8.8.8.8" });
            _list.Add(new PublicDns { Provider = "OpenDNS 208.67.220.220", DNS = "208.67.220.220" });
            _list.Add(new PublicDns { Provider = "电信四川 202.98.96.68", DNS = "202.98.96.68" });//
            _list.Add(new PublicDns { Provider = "电信四川 61.139.2.69", DNS = "61.139.2.69" });
        }
        public string Provider { get; set; }
        public string DNS { get; set; }
    }
}
